/*!
- * OOjs v1.1.8 optimised for jQuery
+ * OOjs v1.1.9 optimised for jQuery
* https://www.mediawiki.org/wiki/OOjs
*
* Copyright 2011-2015 OOjs Team and other contributors.
* Released under the MIT license
* http://oojs.mit-license.org
*
- * Date: 2015-07-23T19:16:00Z
+ * Date: 2015-08-25T21:35:29Z
*/
( function ( global ) {
oo = {},
// Optimisation: Local reference to Object.prototype.hasOwnProperty
hasOwn = oo.hasOwnProperty,
- toString = oo.toString;
+ toString = oo.toString,
+ // Object.create() is impossible to fully polyfill, so don't require it
+ createObject = Object.create || ( function () {
+ // Reusable constructor function
+ function Empty() {}
+ return function ( prototype, properties ) {
+ var obj;
+ Empty.prototype = prototype;
+ obj = new Empty();
+ if ( properties && hasOwn.call( properties, 'constructor' ) ) {
+ obj.constructor = properties.constructor.value;
+ }
+ return obj;
+ };
+ } )();
/* Class Methods */
// allows people to comply with their style guide.
targetFn['super'] = targetFn.parent = originFn;
- targetFn.prototype = Object.create( originFn.prototype, {
+ targetFn.prototype = createObject( originFn.prototype, {
// Restore constructor property of targetFn
constructor: {
value: targetConstructor,
// Extend static properties - always initialize both sides
oo.initClass( originFn );
- targetFn.static = Object.create( originFn.static );
+ targetFn.static = createObject( originFn.static );
};
/**
oo.cloneObject = function ( origin ) {
var key, r;
- r = Object.create( origin.constructor.prototype );
+ r = createObject( origin.constructor.prototype );
for ( key in origin ) {
if ( hasOwn.call( origin, key ) ) {
}
};
+/*global createObject */
+
/**
* @class OO.Factory
* @extends OO.Registry
// the constructor's prototype (which also makes it an "instanceof" the constructor),
// then invoke the constructor with the object as context, and return it (ignoring
// the constructor's return value).
- obj = Object.create( constructor.prototype );
+ obj = createObject( constructor.prototype );
constructor.apply( obj, args );
return obj;
};